package com.hadoopSpark.application.test;

import java.io.IOException;

import com.aliyun.configuration.ConfigurationTool;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.cs.model.v20151215.DescribeApiVersionRequest;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.exceptions.ServerException;
import com.aliyuncs.http.HttpRequest;
import com.aliyuncs.http.HttpResponse;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile;
import com.common.constant.Constant;

/*
 * 显示一个应用的基本信息
 */
public class ShowAppInfo {
	public static void main(String[] args) {
		String accessKeyID = ConfigurationTool.getProperties(Constant.ACCESS_KEY_ID);
		String accessKeySecret = ConfigurationTool.getProperties(Constant.ACCESS_KEY_SECRET);
		String regionID = ConfigurationTool.getProperties(Constant.REGION_ID);
		
		DescribeApiVersionRequest describeApiVersionRequest = new DescribeApiVersionRequest();
		
		IClientProfile profile = DefaultProfile.getProfile(regionID, accessKeyID, accessKeySecret);
		
		IAcsClient client = new DefaultAcsClient(profile);
		
		HttpRequest httpRequest = new HttpRequest("https://master1.cs-cn-beijing.aliyun.com:13836/projects/dockertest1");
		
		System.out.println("-------------------");
		System.out.println(httpRequest.toString());
		System.out.println("-------------------");
		
		
		try {
			HttpResponse httpResponse = client.doAction(describeApiVersionRequest);
			try {
				System.out.println(httpResponse.getResponse(httpRequest));
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			};
			
			System.out.println("-------------<>------");
			System.out.println(httpResponse.getUrl());
//			System.out.println(new String(httpResponse.getContent()));
			
		} catch (ServerException e) {
			e.printStackTrace();
		} catch (ClientException e) {
			e.printStackTrace();
		}

		
	}
}













